﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace WebApplication1
{
    public partial class etymonline : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            var word = Request.QueryString["s"];
            if (!string.IsNullOrEmpty(word))
            {
                var result = WebResourceRequest.CallUrlRequest(string.Format("http://www.etymonline.com/index.php?term={0}", word));
                result = result.Replace("/index", "http://www.etymonline.com/index");
                var startIndex = result.IndexOf("<div id=\"dictionary\">");
                var endIndex = result.IndexOf("<div id=\"google-adsense\">");
                content.InnerHtml = result.Substring(startIndex, endIndex - startIndex);
            }
        }
    }
}